package com.juyu.miliao.api.dao.mysql;

import com.juyu.miliao.api.domain.BuyLimit;
import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName: BuyLimitDao
 * @Description: TODO
 * @Author zhangcheng
 * @Date 19-9-12下午3:03
 */
@Repository
public class BuyLimitDao {
    @Resource
    private SqlSession sqlSession;

    public List<BuyLimit> listBuyLimit(LocalDateTime time, Integer state) {
        Map<String, Object> params = new HashMap<>(16);
        params.put("time", time);
        params.put("state", state);
        return sqlSession.selectList("listBuyLimit", params);
    }

    public int updateBuyLimit(BuyLimit buyLimit) {
        Map<String, Object> params = new HashMap<>(16);
        params.put("id", buyLimit.getId());
        params.put("boughtNum", buyLimit.getBoughtNum());
        return sqlSession.update("updateBuyLimit", params);
    }


}
